//
//  URLEx.swift
//  Risac
//
//  Created by remy on 2018/3/27.
//

import Foundation

extension URL {
    
    public var queryItems: [String: String]? {
        guard let components = URLComponents(url: self, resolvingAgainstBaseURL: false), let queryItems = components.queryItems else { return nil }
        return queryItems.reduce(into: [String: String]()) {
            $0[$1.name] = $1.value ?? ""
        }
    }
}
